//
//  ButtonCollectionViewCell.m
//  XMenSwift
//
//  Created by Jason on 2022/3/24.
//

#import "ButtonCollectionViewCell.h"
#import "Utils.h"
#import <Masonry/Masonry.h>

@interface ButtonCollectionViewCell ()
/** <#名字#> */
@property (nonatomic ,strong) UIView *bgView;

/** <#名字#> */
@property (nonatomic ,strong) UILabel *titleLabel;



@end
@implementation ButtonCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self configUI];
    }
    return self;
}

- (void)configUI {
    
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = [UIColor whiteColor];
    _bgView = bgView;
    [self.contentView addSubview:bgView];
    ViewBorderRadius(_bgView, 4.0, 1, [UIColor blueColor]);
   
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.font = [UIFont systemFontOfSize:15.0];
    titleLabel.textColor = [UIColor grayColor];
    titleLabel.text = @"按钮名称";
    titleLabel.textAlignment = NSTextAlignmentCenter;
    //设置字体缩放
    titleLabel.adjustsFontSizeToFitWidth = YES;
    //最小五号
    titleLabel.minimumScaleFactor = 0.5;
    [bgView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgView);
        make.left.equalTo(bgView).offset(4);
        make.right.equalTo(bgView).offset(-4);
        make.bottom.equalTo(bgView);
    }];

}

@end
